package com.own.business.system.parameter.base.frame.entity.bo;

import com.own.business.system.parameter.base.frame.entity.po.SystemParameter;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * SystemParameterBo
 *
 * @author chenxueli
 * @date 2023-06-29 09:42:59
 */
@Schema(title = "系统参数" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemParameterBo extends BaseBo<SystemParameter> implements Serializable {

    @Schema(title = "系统参数组")
    private String parameterGroup;

    @Schema(title = "系统参数名称")
    private String parameterName;

    @Schema(title = "系统参数唯一编号")
    private String parameterCode;

    @Schema(title = "参数值")
    private String parameterValue;

    @Schema(title = "生效的环境")
    private String effectiveEnvironment;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemParameter toPo(SystemParameter entity) {
        if (entity == null) {
            entity = new SystemParameter();
        }
        entity.setParameterGroup(this.parameterGroup);
        entity.setParameterName(this.parameterName);
        entity.setParameterCode(this.parameterCode);
        entity.setParameterValue(this.parameterValue);
        entity.setEffectiveEnvironment(this.effectiveEnvironment);
        return super.toPo(entity);
    }

}

